const Service = require('egg').Service;

class LabelService extends Service {
    async label_edit(params) {
        const Label = this.ctx.model.Label,
            newLabel = new Label(params);
        return await this.ctx.model.Label.saveLabel(newLabel);
    }
    async label_list() {
        return await this.ctx.model.Label.findAll({});
    }
    async label_del({id}) {
        return await this.ctx.model.Label.del({id});
    }
    async add_article(params) {
        return await this.ctx.model.Label.addArticle(params);
    }
    async del_article({lid, aid}) {
        return await this.ctx.model.Label.delArticle({lid, aid});
    }
}

module.exports = LabelService;